package com.itggm.controller;

import com.itggm.DTO.ActivityPageDTO;
import com.itggm.pojo.Activity;
import com.itggm.response.ResponseResult;
import com.itggm.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: ggm
 * @data 2024年11月19日 13:42
 */
@RestController
@RequestMapping("active")
public class ActivityController {
    @Autowired
    private ActivityService activityService;

     /**
      * @Author: ggm
      * @date:  2024/11/19
      * 分页查询
      */
     @GetMapping("/page")
     public ResponseResult page(ActivityPageDTO activityPageDTO){
         return activityService.page(activityPageDTO);
     }

      /**
       * @Author: ggm
       * @date:  2024/11/19
       * 发布活动
       */
      @PostMapping("/add")
      public ResponseResult add(@RequestBody Activity activity){
          return activityService.add(activity);
      }
       /**
        * @Author: ggm
        * @date:  2024/11/19
        * 批量删除
        */
       @PostMapping("delete")
        public ResponseResult delete(@RequestBody List<Integer> ids){
           return activityService.delete(ids);
       }
        /**
         * @Author: ggm
         * @date:  2024/11/19
         */
        @GetMapping("/front/list/{limit}")
        public ResponseResult activityList(@PathVariable("limit") Integer limit){

            return  activityService.selectactivityList(limit);


        }


}
